﻿/*版权声明
 * 
 * 本 WebName:IMIS_ERP 由
 * 河北大学 信管团队 开发
 * 如有任何疑问请联系开发人员
 * 
 * 项目开发者
 * 负责人：朱胜贤
 * 成员：水亚亚、孙旭峰、张文元、项玥、吕芳、吴凡、谢静、李亚慧
 * 
 * 如有任何疑问请联系：河北大学信管团队
 * QQ：196396337
 * Email:zagelover@163.com
 * HomePage：http://sxgzs.com/
 * 
 * CopyRight (c) 河北大学信管团队 2010~2020
 */

using System;
using System.Collections.Generic;
using System.Data.SqlClient;
using System.Data;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace IMIS_ERP.Web.Order_Info
{
    public partial class Search_Shop : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                IMIS_ERP.BLL.Shop_Info bll = new BLL.Shop_Info();
                IMIS_ERP.Model.Shop_Info model =bll.GetModel(Session["siID"].ToString());
                //大学生店/旗舰店隐藏结算金额
                if (model.siIsFlagship)
                {
                    GV.Columns[3].Visible = false;
                }

            }
        }

        protected void btnSave_Click(object sender, EventArgs e)
        {
            IMIS_ERP.BLL.Order_Products bll = new IMIS_ERP.BLL.Order_Products();
            SqlDataReader dr = bll.GetSiSum(Session["siID"].ToString(), ddloiStatus.SelectedValue, txthTime1.Text.Trim() + " 00:00:00", txthTime2.Text.Trim() + " 23:59:59");
            DataTable dt = new DataTable();
            dt.Columns.Add("opPcID");
            dt.Columns.Add("opNumSum");
            dt.Columns.Add("opAreaSum");
            dt.Columns.Add("opWeightSum");
            dt.Columns.Add("opFee1Sum");
            dt.Columns.Add("opFee2Sum");
            decimal sum0 = 0, sum1 = 0, sum2 = 0, sum3 = 0, sum4 = 0;
            if (dr.HasRows)
            {
                while (dr.Read())
                {
                    dt.Rows.Add(dr["opPcID"], dr["opNumSum"], dr["opAreaSum"], dr["opWeightSum"], dr["opFee1Sum"], dr["opFee2Sum"]);
                    sum0 += Convert.ToDecimal(dr["opNumSum"]);
                    sum1 += Convert.ToDecimal(dr["opAreaSum"]);
                    sum2 += Convert.ToDecimal(dr["opWeightSum"]);
                    sum3 += Convert.ToDecimal(dr["opFee1Sum"]);
                    sum4 += Convert.ToDecimal(dr["opFee2Sum"]);
                }
            }
            dt.Rows.Add("总计", sum0, sum1, sum2, sum3, sum4);
            GV.DataSource = dt;
            GV.DataBind();
            dr.Close();
        }

        /// <summary>响应GridView事件：创建数据行时
        /// 	<remark>2010-12-08 BY 河北大学信管团队</remark>
        /// </summary>
        protected void GV_RowCreated(object sender, GridViewRowEventArgs e)
        {
            if (e.Row.RowType == DataControlRowType.DataRow)
            {
                //为数据行增加鼠标移动到行特性
                e.Row.Attributes.Add("onmouseover", "c=style.backgroundColor;this.style.backgroundColor='" + IMIS_ERP.BLL.Assistant.getColor1 + "'");
                //为数据行增加鼠标离开行特性
                e.Row.Attributes.Add("onmouseout", "this.style.backgroundColor=c");
            }
        }
    }
}